% My defs

% Computer Text, Computer text=>, Computer Text Display
\newcommand{\ct}[1]{\textsf{\smaller{}#1}}
\newcommand{\ctr}[1]{\ct{#1} / }

\newenvironment{ctd}{\begin{quote}\footnotesize\tt}{\end{quote}}
\pagecolor{white}

% abbreviations
\newcommand{\nip}{\ct{nip2}}
\newcommand{\bs}{$\backslash$}
\newcommand{\rtp}{\^{ }}
\newcommand{\cielab}{\emph{CIE~}$L^{*}a^{*}b^{*}$}
\newcommand{\ciexyz}{\emph{CIE XYZ}}
\newcommand{\cross}{$\times{}$}

% make a label ... override this for HTML output and insert an anchor
\newcommand{\mylabel}[1]{\label{#1}}

% generate " on page xx" if a label is referring to something on another page
% override this for HTML output
\newcounter{boink}
\newcommand{\onpage}[1]{%
\addtocounter{boink}{1}%
\label{atref\theboink{}}%
\ifthenelse{\pageref{atref\theboink{}}=\pageref{#1}}%
{}%
{ on page~\pageref{#1}}}

% format a reference to a section .. "$3.11 on page 37"
\newcommand{\pref}[1]{\S\ref{#1}\onpage{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}\onpage{#1}}
\newcommand{\fref}[1]{Figure~\ref{#1}\onpage{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}\onpage{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}\onpage{#1}}

% Insert a file ... height and name.
\newcommand{\fig}[2]{
	\begin{center}
	\includegraphics[height=#1]{figs/#2}
	\end{center}
}

% Insert a file ... width and name.
\newcommand{\figw}[2]{
	\begin{center}
	\includegraphics[width=#1]{figs/#2}
	\end{center}
}

% make a 2-column figure ... define our own so we can easily override in html
% output
\newenvironment{fig2}{\begin{figure*}}{\end{figure*}}

% same for 2-col tables
\newenvironment{tab2}{\begin{table*}}{\end{table*}}

% causes problems for htlatex :-( 
% make this a noop for now
% \newcommand{\dtxt}[1]{\multicolumn{25}{@{\hspace{0.2em}}l}{#1}}
\newcommand{\dtxt}[1]{#1}

% Insert a blank page
\newcommand{\blankpage}{%
\newpage
~~~~
\pagestyle{plain}
\newpage
% Another one necessary in twocolumn mode
~~~~
\newpage
\pagestyle{fancy}
}

%\addtolength{\headheight}{3pt}

% Make text a bit wider, since we are two column.
\addtolength{\textwidth}{0.5in}
\addtolength{\oddsidemargin}{-0.25in}
\addtolength{\evensidemargin}{-0.25in}

% twocolumn seems to remove the binding offset ... add it back
%\addtolength{\oddsidemargin}{-0.2in}
%\addtolength{\evensidemargin}{0.2in}

% More space between headers and footers and the body
\addtolength{\topmargin}{-0.5em}
\addtolength{\headsep}{0.5em}
\addtolength{\footskip}{0.5em}

% Swap left and right binding offsets
\newlength{\fred}
\setlength{\fred}{\oddsidemargin}
\setlength{\oddsidemargin}{\evensidemargin}
\setlength{\evensidemargin}{\fred}
